﻿using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace Api.Models
{
    [SugarTable("user")]
    public class User
    {
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        [Required]
        [SugarColumn(ColumnName = "username", Length = 50)]
        public string? Username { get; set; }

        [Required]
        [EmailAddress]
        [SugarColumn(ColumnName = "email", Length = 255, IsNullable = false)]
        public string? Email { get; set; }

        [SugarColumn(ColumnName = "password_hash")]
        public byte[]? PasswordHash { get; set; }

        [SugarColumn(ColumnName = "password_salt")]
        public byte[]? PasswordSalt { get; set; }

        [SugarColumn(ColumnName = "email_verified")]
        public bool? EmailVerified { get; set; } = false;

        [SugarColumn(ColumnName = "verification_token")]
        public string? VerificationToken { get; set; }

        [SugarColumn(ColumnName = "created_at")]
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

        [SugarColumn(ColumnName = "updated_at")]
        public DateTime? UpdatedAt { get; set; }
    }
}
